// 请求响应参数（不包含data）
export interface Result {
  code: string | number;
  msg: string;
}

// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
  data: T;
}

// 分页响应参数
export interface ResPage<T> {
  list: T[];
  pageNum: number;
  pageSize: number;
  total: number;
}

// 分页请求参数
export interface ReqPage {
  pageNum: number;
  pageSize: number;
}

// 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    fileUrl: string;
    file_path: string;
  }
}

// 登录模块
export namespace Login {
  export interface ReqLoginForm {
    username: string;
    password: string;
    platform_type: string;
    captchaVerification?: string;
  }
  export interface PhoneLoginForm {
    mobile: string;
    validCode: string;
    captchaVerification?: string;
  }
  export interface PhoneChangePwd {
    mobile: string;
    validCode: string;
    newPassword?: string;
    confirmPassword?: string;
    captchaVerification?: string;
  }
  export interface ResLogin {
    access_token: string;
  }
  export interface ResAuthButtons {
    [key: string]: string[];
  }
  export interface ResPermission {
    // [key: string]: string[];
    permissions: string[];
    roles: string[];
    user: {
      name: string;
      avatar: string;
      [key: string]: string;
    };
  }
}

// 用户管理模块
export namespace User {
  export interface ReqUserParams extends ReqPage {
    username: string;
    gender: number;
    idCard: string;
    email: string;
    address: string;
    createTime: string[];
    status: number;
  }
  export interface ResUserList {
    id: string;
    userId: string;
    userName: string;
    nickName?: string;
    password: string;
    sex: number;
    user: { detail: { age: number } };
    deptId: number;
    roleId: number;
    roleIds: number[];
    idCard: string;
    phonenumber: string;
    email: string;
    address: string;
    createTime: string;
    status: number;
    avatar: string;
    photo: any[];
    children?: ResUserList[];
  }
  export interface ResStatus {
    userLabel: string;
    userValue: number;
  }
  export interface ResGender {
    genderLabel: string;
    genderValue: number;
  }
  export interface ResDepartment {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
  export interface ResRole {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
}

// 租户信息
export interface Tenant {
  accountCount: number;
  code: string;
  contactMobile: string;
  contactName: string;
  createTime: Date;
  description: string;
  domain: string;
  expireTime: Date;
  id: number;
  isInternational: boolean;
  name: string;
  packageId: number;
  publicClass: boolean;
  shortName: string;
  status: number;
  teachingClass: boolean;
}
